1. Field of the Invention
The disclosure relates generally to mapping management methods and systems, and, more particularly to mapping management methods and systems adapted to non-volatile memory that integrate a block mapping mode and a page mapping mode.
2. Description of the Related Art
Non-volatile memory, like Flash memory, is widely used nowadays and it is characterized that the unit for read/write is a page, and the unit for erase is a block, and the data must be erased before write. The characteristic makes it difficult to manage the read and write commands with Logic Block Address (LBA) from the host or the applications and to translate the logic addresses into physical addresses to access the physical block of the non-volatile memory. Therefore, a translation layer is always used between the file system of the host and the non-volatile memory to manage the read and write commands from the host and to access data in the memory. In conventional storage management for a non-volatile memory, data is accessed and addressed using a page mapping mode, a block mapping mode, a replacement block mode, or a log block mode.
In the page mapping mode, data in the storage unit is stored in a unit of a logic page, and has a corresponding page mapping table. In the page mapping table, the logic page number is indexed, and a physical page number is the table entry (item content). When a storage system using the page mapping mode handles read and write commands, physical data pages can be addressed by directly querying and updating the page mapping table. In the block mapping mode, data in the storage unit is stored in a unit of a logic block, and has a corresponding block mapping table. In the block mapping table, the logic block number is an index, and a physical block number is the table entry. When a storage system using the block mapping mode handles read and write commands, physical data pages can be addressed by directly querying and updating the block mapping table. However, for a rewrite command, a physical block must be first allocated, so that the requested page may be written to the allocated physical block. Then, other pages belonging to the same logic block must be copied to the allocated physical block, which is very time consuming. Therefore, the replacement block mode is applied. In the replacement block mode, each logic block has a series of linked replacement blocks in addition to a physical data block. When a page is rewritten, the first empty replacement block is sought from the linked sequence. If the empty replacement block is found, data is written to a position corresponding to the page number in the replacement block. If no empty replacement block is found, a new replacement block is added to the end of the linked sequence, and data is written to a position corresponding to the page number in the new replacement block. In the log block mode, one or a predefined number of log blocks are allocated for one, several linked, or all logic blocks. The log blocks can be used to store data which was requested to be written to the logic blocks. When read and write commands are handled, a log block must be scanned to determine whether the corresponding logic block is clean (no data in the log block), or a page mapping table corresponding to the logic block is found.
Because of the characteristic of the flash memory that the unit for read/write is a page, and the unit for erase is a block, and data must be erased before write. Therefore, when a storage system using the block mapping mode handles a write command, the original physical data block must be erased once. Thus, write efficiency is lowed when the block size is increased. In the page mapping mode, the data distribution is complex. When no empty physical block can be used, the procedure of data merge for obtaining a new empty physical block is complicated. Additionally, with the development of IC manufacturing technology, the page/block size has been substantially increased. Further, respective pages in each block of a high capacity storage unit, such as a NAND flash memory, cannot be randomly written, but must be written in sequence. Obviously, the replacement mode, wherein the respective pages in a block must be written randomly can not be adapted. In the log block mode, only recent updated data pages may use the page mapping mode for saving the storage space of the page mapping table. Therefore, when the storage unit is required to be accessed, a specific table must be scanned to ensure whether the requested data is in the page mapping area, thus decreasing system efficiency. In some hybrid mapping modes, such as integrating the block mapping mode and the page mapping mode, similar to the log block mode, when the storage unit is required to be accessed, a specific table must be scanned to ensure whether the requested data is in the page mapping area. In the hybrid mapping modes, the area of page mapping must be limited to avoid a lengthy time being spent on the scanning procedure, thus decreasing system efficiency. However, if the area of page mapping is too small, it will be easily filled, and one or several data merges must be performed before handling other write commands, thus also decreasing system efficiency.